package queue;

import java.util.Stack;

public class CQueue {
    Stack<Integer> s1;
    Stack<Integer> s2;
    public CQueue() {
        s1 = new Stack<Integer>();
        s2 = new Stack<Integer>();
    }

    public void appendTail(int value) {
        s1.push(value);
    }

    public int deleteHead() {
        int result = -1;
        if (!s1.empty()){
            while (s1.size()>1){
                s2.push(s1.pop());
            }
            result = s1.pop();
        }


        if (!s2.empty()){
            while(s2.size()>0){
                s1.push(s2.pop());
            }
        }

        return result;
    }

    public static void main(String[] args) {
        CQueue cQueue = new CQueue();
        cQueue.appendTail(3);
        System.out.println(cQueue.deleteHead());
        System.out.println(cQueue.deleteHead());
    }
}
